﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web;
namespace Common
{
    public class Util
    {
        public static string returnResponsebody(Stream inputStream)
        {
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
            // Pipes the stream to a higher level stream reader with the required encoding format. 
            StreamReader readStream = new StreamReader(inputStream, encode);
            string str = readStream.ReadToEnd();
            return str;
        }

        public static string SHA1Encrypt(string content)
        {
            return  System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(content, "SHA1");
        }
        public static bool IsParamInQueryString(string keyName)
        {
            if (HttpContext.Current.Request.QueryString[keyName] != null)
                return true;

            return false;
        }

        public static bool IsStringEmpty(string val)
        {
            return (val != null && val.Trim().Length != 0);
        }
    }
}
